﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="per_zhanyemeitiyuce_manage.aspx.cs" Inherits="per_zhanyemeitiyuce_manage" MasterPageFile="~/APP_Master/MasterPage_Personal.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="App_Themes/css/webstyle.css" rel="stylesheet" />

    <script src="App_Themes/js/jiangjinjisuan/jquery-1.js" type="text/javascript"></script>
    <style>
        .per_header_topup {
            border: none;
            width: 65px;
            height: 26px;
            background: url(/images/p_bg01.gif);
            color: #FFF;
            margin: 0 15px 20px 35px;
            text-align: center;
            line-height: 25px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            init();

        }
       );
        function init() {
            getQs(),
            $("#LotteryType").on("change", function () {
                getQs();
            }),
            $("#submit").on("click", function () {
                var type = $("#LotteryType").val();

                if (type == 1) {
                    CreateSSQ();
                }
                else {
                    CreateDLT();
                }
                //$("#LotteryType").val()= 1 ? CreateSSQ() : CreateDLT();
            })

        }
        //期数
        function getQs() {
            var LotteryType = $("#LotteryType").val();
            $.ajax({
                url: "/Ajax/LotteryData.ashx",
                data: { t: 'GetCurrentLotteryQs', LotteryType: LotteryType },
                type: "get",
                dataType: "json",
                success: function (data) {
                    $("#LotteryQs").val(data);
                }
            });
        }
        function FabuYuCe(yRedball, yBlueball) {
            var LotteryType = $("#LotteryType").val();
            var LotteryQs = $("#LotteryQs").val();
            $.ajax({
                url: "/Ajax/LotteryData.ashx",
                data: { t: 'FaBuMeiTiYuCe', LotteryType: LotteryType, LotteryQs: LotteryQs, yRedball: yRedball, yBlueball: yBlueball },
                type: "post",
                dataType: "json",
                success: function (data) {
                    if (data > 0) {
                        alert("方案发布成功！")
                    }
                }
            });
        }
        function CreateSSQ()//发布双色球方案
        {
            var strR = $("#redball").val().trim();
            var strB = $("#blueball").val().trim();

            if (strR.length > 0 || strB.length > 0) {
                var Red, Blue = [];
                var yRedball = FullToDBC(strR);
                var yBlueball = FullToDBC(strB);

                if (yRedball.length == 35 && yBlueball.length == 8) {
                    Red = yRedball.split(",");
                    Blue = yBlueball.split(",");
                    var f1 = 0, f2 = 0;
                    for (var i = 0; i < Red.length; i++) {
                        if (Red[i].length != 2 || Red[i] == "00") {
                            f1 = f1 + 1;
                            alert("红球数字格式不正确！");
                            break;
                        }

                    }
                    for (var j = 0; j < Blue.length; j++) {
                        if (Blue[j].length != 2 || Blue[j] == "00") {
                            f2 = f2 + 1;
                            alert("篮球数字格式不正确！");
                            break;
                        }
                    }
                    if (f1 == 0 && f2 == 0) {
                        FabuYuCe(yRedball, yBlueball);
                    }

                }
                else {
                    alert("输入数字格式不正确！");
                }
            }
            else {
                alert("红球和篮球都不能为空！");
            }
        }
        function CreateDLT()//发布大乐透方案
        {
            var strR = $("#redball").val().trim();
            var strB = $("#blueball").val().trim();
            if (strR.length > 0 || strB.length > 0) {
                var Red, Blue = [];
                var yRedball = FullToDBC(strR);
                var yBlueball = FullToDBC(strB);

                if (yRedball.length == 32 && yBlueball.length == 11) {
                    Red = yRedball.split(",");
                    Blue = yBlueball.split(",");
                    var f1 = 0, f2 = 0;
                    for (var i = 0; i < Red.length; i++) {
                        if (Red[i].length != 2 || Red[i] == "00") {
                            f1 = f1 + 1;
                            alert("红球数字格式不正确！");
                            break;
                        }

                    }
                    for (var j = 0; j < Blue.length; j++) {
                        if (Blue[j].length != 2 || Blue[j] == "00") {
                            f2 = f2 + 1;
                            alert("篮球数字格式不正确！");
                            break;
                        }
                    }
                    if (f1 == 0 & f2 == 0) {
                        FabuYuCe(yRedball, yBlueball);
                    }

                }
                else {
                    alert("输入数字格式不正确！");
                }
            }
            else {
                alert("红球和篮球都不能为空！");
            }
        }
        //全角字符转为半角字符
        function FullToDBC(Str) {
            var DBCStr = "";
            for (var i = 0; i < Str.length; i++) {
                var c = Str.charCodeAt(i);
                if (c == 12288) {
                    DBCStr += String.fromCharCode(32);
                    continue;
                }
                if (c > 65280 && c < 65375) {
                    DBCStr += String.fromCharCode(c - 65248);
                    continue;
                }
                DBCStr += String.fromCharCode(c);
            }
            return DBCStr.toUpperCase();
        }
    </script>

    <!--Right-->
    <div class="jyc_r">
        <div class="jyc_r_title">
            <ul>
                <li class="jyc_r_t"><a href="per_zhanyemeitiyuce_manage.aspx?u=<%=ReadRequest.RequestInt("u") %>" style="color: #fff;">发布专业媒体预测</a></li>
                <li><a href="per_zhuanyemeitiyuce_list.aspx?u=<%=ReadRequest.RequestInt("u") %>">专业媒体预测管理</a></li>
            </ul>
        </div>
        <table width="666" border="0" cellspacing="0" cellpadding="0" style="line-height: 35px; font-size: 14px; color: #404040;">

            <tr>
                <td height="50" align="right" valign="top">彩票种类：</td>
                <td align="left" valign="top">
                    <select name="select" id="LotteryType" class="jyc_r_bd1">
                        <option value="1">双色球</option>
                        <option value="2">大乐透</option>
                    </select>
                </td>
                <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
                <td height="50" align="right" valign="top">彩票期数：</td>
                <td align="left" valign="top">
                    <input type="text" name="textfield3" id="LotteryQs" class="jyc_r_bd1 fl" readonly="readonly" />
                </td>
                <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
                <td height="50" align="right" valign="top">红球预测号码：</td>
                <td align="left" valign="top">
                    <input type="text" name="textfield2" id="redball" class="jyc_r_bd"></td>
                <td align="left" valign="top" class="jyc_r_text"></td>
            </tr>
            <tr>
                <td height="50" align="right" valign="top">篮球预测号码：</td>
                <td align="left" valign="top">
                    <input type="text" name="textfield3" id="blueball" class="jyc_r_bd1 fl"></td>
                <%-- <span class="jyc_r_text fl">*必选3个</span>--%>
                <td align="left" valign="top">&nbsp;</td>
            </tr>

        </table>
        <div class="jyc_r_text1">
            预测推荐：<br />
            <span class="jyc_r_text2">红球：</span>01,07,08,15,19,21,22,25,26,27,29,11<br />
            <span class="jyc_r_text3">篮球：</span>01,09,13
        </div>
        <div class="tc">
            <input type="button" class="per_header_topup" value="提交" id="submit" />
        </div>
        <div class="jyc_r_text4">
            <span class="jyc_r_text5">温馨提示：</span><br>
            1.双色球红球必须选12个，篮球必须选3个<br />
            2.大乐透红球必选11个，篮球必选4个<br />
            3.红球和蓝球之间用 +号分隔<br />
            4.分个号逗号要用拼音下的半角格式<br />
            5.中英文、符号等非法字符以及无效号码，系统将自动滤除<br />

        </div>
    </div>
    </div>
    <!--Right-->
</asp:Content>
